/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package util;


import dominio.Professores;
import java.io.IOException;
import java.util.Set;
import javax.faces.context.ExternalContext;
import javax.faces.context.FacesContext;
import javax.servlet.http.HttpSession;

/**
 *
 * @author jair
 */
public class ControleAcesso {
    
   private FacesContext ctx = FacesContext.getCurrentInstance();
   private ExternalContext ec = ctx.getExternalContext();
   private HttpSession session = (HttpSession) ec.getSession(true); 

    public FacesContext getCtx() {
        return ctx;
    }

    public void setCtx(FacesContext ctx) {
        this.ctx = ctx;
    }

    public ExternalContext getEc() {
        return ec;
    }

    public void setEc(ExternalContext ec) {
        this.ec = ec;
    }

    public HttpSession getSession() {
        return session;
    }

    public void setSession(HttpSession session) {
        this.session = session;
    }
   
   public Professores retornaLogado(){
        //pegando o usuario logado na secao
        Professores p = (Professores) session.getAttribute("usuarioAutenticado");
        return p;       
    } 
    
   
  
}
